<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"import="base.*,pojo.*,service.*,java.util.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">

#box{
	border: 10px groove #CDC9C9;
	height: 500px;
	width: 500px;
	margin-left:auto;
	margin-right:auto;
}
#b1{
	height: 50px;
	width: 510px;
	margin-top: 35px;
}

#s{
   height:40px;
   width:490px;
   margin-bottom:5px;
   }
  body{
	margin:0;
	padding:20px;
	background-image:url("images/innerBJ.jpg");
	background-repeat:no-repeat;
	font:80% Arial, Helvetica, sans-serif;
	color:#555;
	line-height:100%;
}  
</style>

<script type="text/javascript" src="jquery/jquery-1.6.1.js"></script>
<script type="text/javascript" src="jquery/jquery.validate.min.js"></script>
<script src="jquery/jscal2.js"></script>
    <script src="jquery/cn.js"></script>
    <script type="text/javascript">
$(function(){
	$("#add").click(function(){
	
	var area=$("#area").val();
	var type=$("#type").val();
	var name=$("#name").val();
	if(area==0){
        alert("请选择餐桌类别");
        return false;
    }
   
   else if(type==0){
    alert("请选择餐桌类型");
       return false;
    }
    
    
    else if(name==""){
    alert("请输入餐桌名")
    $("#namel").focus();
     return false;
     }
    else{$("#form1").submit()}
    
	})
})
</script>

</head>


<body>
<%
request.setCharacterEncoding("UTF-8");
TableService m=new TableService();
int id = Integer.valueOf(request.getParameter("id"));
table de = m.getTableDetail(id);
%>
	
	
		<div id="box" >
		  
			 <form id="form1" method="post" action="action/updateTableAction.jsp">
								<input type="hidden" name="id" value="<%=de.getId() %>">
									<div class="field" id="s"><label>餐桌类别:</label>
									<select name="area" id="area" style="width:150px;">
                                         <option value=0>--请选择--</option>
                                         <option value=1>大厅</option>
                                         <option value=2>包厢</option>
                                     </select>
									</div>
									<div class="field" id="s"><label>餐桌类型:</label>
									<select style="width:150px;" name="type" id="type" >
									<%
	                           TableService ds = new TableService();	
	                           List<TableType> list = ds.getTableType();	

	                           for(TableType d:list){
		                       if(d.getId()==de.getType())
			                   out.print("<option value='"+d.getId()+"' selected='selected'>"+d.getName()+"</option>");
		                         else
			                     out.print("<option value='"+d.getId()+"'>"+d.getName()+"</option>");
	                           } 
	                           %>
	
	                                    </select>
									</div>
									<div class="field" style="marggin-bottom:20px;" id="s"><label>餐桌名称:</label><input id="name" name="name" value="<%=de.getName() %>"></div>
									<br>
									<div class="field" id="s"><label>菜品介绍:</label><textarea name="detail" rows="3" cols="30"><%=de.getDetail() %></textarea></div>
									<br/><br/><br/><br/><br/>
									<br/>
								
                                    <button  type="submit" id="add">确认</button>&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" name="reset" value="重置">
                               
								   </form>

			
			
			  
			</div>
		

		
		
    

</body>
</html>
